package com.lemontree.spring.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

@RequestMapping("base/")
@Controller("baseController")
public class BaseController {

    @RequestMapping("/index")
    public ModelAndView basePage() {
        int i = 0;
        if (i == 0)
            throw new NullPointerException();
        return new ModelAndView("index");
    }

    @ExceptionHandler(NullPointerException.class)
    public String getException() {
        System.out.println("NullPoint Exception!");
        return "index";
    }

}
